Wireless service providers and wireless equipment manufacturers constantly seek new ways to make wireless equipment and services as convenient, user-friendly, and affordable as possible. One important aspect of these efforts involves over-the-air (OTA) upgrading of wireless mobile stations, such as cell phones, wireless personal digital assistants (PDAs), wireless hand-held computers, two-way pagers, and the like, as well as fixed wireless terminals. Over-the-air (OTA) upgrading, sometimes called firmware over-the-air (FOTA) upgrading, is a relatively new procedure that enables a mobile station user to download and install updated software containing patches, bug fixes, and newer versions of the software, including the operating system, stored in the wireless mobile station.
Software upgrades are usually delivered to a mobile station in the form of delta files. A mobile station contains a copy of an original (or old) file and it is desired to replace the original file with an upgraded (or new) file. However, many software programs and other files are quite large and delivering the entire upgraded file over the air is generally impractical, if not impossible. To overcome this problem, OTA upgrade operations often use delta files.
Delta files are generated by detecting the differences between the original file and the upgraded file. The detected differences are then used to create the delta file, which contains data and instructions that can be used to convert the original file to the upgraded file. When the delta file is delivered to the wireless mobile station, the instructions in the delta file are executed and the data from the delta file is used to modify (or patch) the original file, thereby converting the original file to the upgraded file in the mobile station. The advantage to this method is that the delta file is typically much smaller than either the original file or the upgraded file.
A number of method exist for generating delta files. However, each of these methods suffers from one or more significant drawbacks. A popular delta generation algorithm proposed by Reichenberger, also known as the “greedy” algorithm is very good at generating delta files that are theoretically the minimum possible size. However, the greedy algorithm is practically unusable for any file that is larger than 4 megabytes (4 Mb) in size, because of the time required to generate the delta file. The greedy algorithm requires O(n2) memory and runtime, where n is the combined length the old and new files. For large values of n, generating a delta file may require many hours or even days to complete.
Another popular delta generation algorithm is the xdelta introduced by Josh MacDonald. The xdelta algorithm runs in linear time, but the delta file size is much larger than the greedy delta algorithm. This is a problem for wireless applications, because may wireless service providers impose restrictions on delta file sizes. Furthermore, the delta-apply software (i.e., the “patch client”) that runs on the mobile station will have erratic Flash memory sector-write patterns. This results in increased patch-apply times. Wireless service providers generally also impose strict limits on patch-apply times (e.g., less than 10 minutes). An additional problem with erratic Flash memory sector-write operations is the resulting wear-and-tear on the physical Flash memory part. As is well known, Flash memories have limited erase-write cycles (e.g., approx 10,000).
Finally, xdelta instructions assume that reconstruction of the upgraded file from the original file does not happen in place. The upgraded file is assumed to be separate and distinct from the old file. At the end of the reconstruction, the old file is deleted, leaving only the upgraded file. Thus, during the generation of the upgraded file, a Flash memory size of twice the image file sized is needed.
The vcdiff algorithm proposed by Kiem Phong Vo is another linear time algorithm, similar to the xdelta algorithm. As a result, the vcdiff algorithm suffers from drawbacks similar to the drawbacks affecting the xdelta algorithm. Finally, the rsync algorithm introduced by Andrew Tridgell is designed to minimize the amount of traffic exchanged between the client and the server. However, it does not optimize anything else. Thus, its use in firmware over-the-air (FOTA) applications is very limited.
The prior art algorithms for generating delta files are also handicapped by the manner in which conventional linker programs generate the original binary file and upgraded binary file from which the delta files are generated. A linker takes object files and produces an executable file. More particularly, the linker takes one or more object files, libraries, and address details as input from a memory map input file and produces an output file suitable for execution. However, in conventional linkers, the output executable is monolithic in nature. The output executable does not have a deterministic ordering of functions, variables, and the like. These details are left entirely up to the linker.
Current linkers do not have any order in choosing object files. Further more, the order in which read-write data (“RW data”) is gathered is also undefined (i.e., random). Due to the unique nature of instruction sets such as the ARM microprocessor instruction set, branch instruction encoding, jump instruction encoding, and function call instruction encoding change when the address references for these instructions change. When new software modules are added or deleted from a file (due to a bug fix, etc.), the output executable will have changes to the jump, branch, and function call instructions.
These changes, in turn, cascade into other modules due to intra-module references. The cascading changes result in two binaries (an original binary file and an upgraded binary file) that are drastically different. This causes a great increase in the size of the delta file generated between the original binary file and the upgraded binary file. Thus, existing linkers not only fail to preserve spatial locality of reference in software code, existing linkers actually cascade changes. Thus, relatively small changes in software results in large changes in the output executable. These qualities are very bad for the generation of delta files for FOTA applications.
Therefore, there is a need in the art for an improved apparatus and method for generating delta files for performing over-the-air upgrades of wireless mobile stations. In particular, there is a need for a delta-file generation method that provides an optimum balance between the size of a delta file and the time required to generate the delta file. More particularly, there is a need for an improved linker that prevents the cascading of small changes in a software file into large changes in the final output executable file.